package io;
/*
 * 对象序列化   输出（从程序到文件）
 */

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name = "三三";
        String gender = "女";
        int age = 18;
        String[] otherinfomation = {"喜欢打枪，唱、跳、rap、篮球"};
        Student ss = new Student(name,gender,age,otherinfomation);
        System.out.println(ss);
        //对象输出流在序列化对象时，必须保证序列化对象实现Serializable接口
        FileOutputStream fos = new FileOutputStream("yalax.txt");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(ss);
        System.out.println("写出完毕");
        oos.close();
    }
}
